(function(angular) {
	'use strict';
	angular.module('fs.waf').controller('cda.prodSubtype.viewController', viewController);
	viewController.$inject = [ '$scope', 'Constants', 'layoutConfig', 'validatorConfig', 'gridService', 'authService', 'prodSubtypeService', 'modalService', '$log' ];
	function viewController($scope, Constants, layoutConfig, validatorConfig, gridService, authService, prodSubtypeService, modalService, $log) {
		var ctrl = this, prodSubtypeInfo = $scope.$stateParams.params;
		ctrl.layoutConfig = layoutConfig;
		ctrl.validatorConfig = validatorConfig;
		ctrl.prodSubtype = {};
		ctrl.init = function() {	
			ctrl.innerGridOptions = gridService.createInnerGridOptions($scope, ctrl.layoutConfig.formConfigs.general);
			ctrl.innerGridOptions.data = 'vm.prodSubtype.intList';
			
			return authService.view(prodSubtypeInfo).then(function(response) {
				ctrl.prodSubtype = response.data || prodSubtypeInfo;
			}, angular.noop);
		};
		
		
		function rowSelectionChanged(eventRow, selectedRows) {
			$log.debug('row selected:' + selectedRows);
			ctrl.selectedEventRows = selectedRows;
		}		
	}
})(angular);